﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using l1cs.server.model.Instance;
using l1cs.server.model;

namespace l1cs.server.serverpackets
{
    public class S_AttackMissPacket : ServerBasePacket
    {
        private byte[] _byte = null;

        public S_AttackMissPacket( L1Character attacker, int targetId )
        {
            writeC( Opcodes.S_OPCODE_ATTACKPACKET );
            writeC( 1 );
            writeD( attacker.getId() );
            writeD( targetId );
            writeC( 0 );
            writeC( attacker.getHeading() );
            writeD( 0 );
            writeC( 0 );
        }

        public S_AttackMissPacket( L1Character attacker, int targetId, int actId )
        {
            writeC( Opcodes.S_OPCODE_ATTACKPACKET );
            writeC( actId );
            writeD( attacker.getId() );
            writeD( targetId );
            writeC( 0 );
            writeC( attacker.getHeading() );
            writeD( 0 );
            writeC( 0 );
        }

        public S_AttackMissPacket( int attackId, int targetId )
        {
            writeC( Opcodes.S_OPCODE_ATTACKPACKET );
            writeC( 1 );
            writeD( attackId );
            writeD( targetId );
            writeC( 0 );
            writeC( 0 );
            writeD( 0 );
        }

        public S_AttackMissPacket( int attackId, int targetId, int actId )
        {
            writeC( Opcodes.S_OPCODE_ATTACKPACKET );
            writeC( actId );
            writeD( attackId );
            writeD( targetId );
            writeC( 0 );
            writeC( 0 );
            writeD( 0 );
        }

        override
        public byte[] getContent()
        {
            if ( _byte == null )
            {
                _byte = getBytes();
            }
            return _byte;
        }

        override
        public String getType()
        {
            return "[S] S_AttackMissPacket";
        }
    }
}